$(function() {

  $('.clock').each(function(i, el) {
    
    var canvasId = $(el).children().first().attr('id');
    var offset = $(el).attr('offset');
    var body = $(el).attr('body') != null ? $(el).attr('body') : StationClock.RoundBody;
    var dial = $(el).attr('dial') != null ? $(el).attr('dial') : StationClock.SwissStrokeDial;
    var hourHand = $(el).attr('hourHand') != null ? $(el).attr('hourHand') : StationClock.SwissHourHand;
    var minuteHand = $(el).attr('minuteHand') != null ? $(el).attr('minuteHand') : StationClock.SwissMinuteHand;
    var secondHand = $(el).attr('secondHand') != null ? $(el).attr('secondHand') : StationClock.SwissSecondHand;
    var boss = $(el).attr('boss') != null ? $(el).attr('boss') : StationClock.NoBoss;
    var minuteHandBehavior = $(el).attr('minuteHandBehavior') != null ? $(el).attr('minuteHandBehavior') : StationClock.BouncingMinuteHand;
    var secondHandBehavior = $(el).attr('secondHandBehavior') != null ? $(el).attr('secondHandBehavior') : StationClock.OverhastySecondHand;
    var redrawInterval = $(el).attr('redrawInterval') != null ? $(el).attr('redrawInterval') : 50;

    var clock = new StationClock(canvasId, offset);
    clock.body = parseInt(body);
    clock.dial = parseInt(dial);
    clock.hourHand = parseInt(hourHand);
    clock.minuteHand = parseInt(minuteHand);
    clock.secondHand = parseInt(secondHand);
    clock.boss = parseInt(boss);
    clock.minuteHandBehavoir = parseInt(minuteHandBehavior);
    clock.secondHandBehavoir = parseInt(secondHandBehavior);
    window.setInterval(function() { clock.draw() }, parseInt(redrawInterval));

  });

});
